/* 反射Reflect, 都是静态方法 */

/* 反射常用API: get set has*/
{
    let obj = {
        time: '2017-03-11',
        name: 'net',
        _r: 123
    };
    console.log('Reflect get', Reflect.get(obj, 'time'));
    Reflect.set(obj, 'name', 'mukewang');
    console.log(obj);
    console.log('has', Reflect.has(obj, 'name'));
}



/* 获得所有对象属性的名字 ownKeys */
{
    let student = {
        name: "xiaoming",
        age: 12
    }
    let keyList = Reflect.ownKeys(student);
    console.log(keyList);   // [ 'name', 'age' ]
    /* 遍历所有的值 */
    keyList.forEach(item => console.log(student[item]));
}